<script type="text/javascript">
    $(document).ready(function() {                    
        //------- Google Maps ---------//
        
<?php $i = 0 ?>        
<?php foreach ($doctor->getLocations() as $doctorLocation): ?>
    <?php $i++ ?>             
    <?php if ($i == 1): ?>                		  
                    // Creating a LatLng object containing the coordinate for the center of the map
                    var latlng = new google.maps.LatLng(<?php echo $doctorLocation->getLatitude() . ", " . $doctorLocation->getLongitude() ?>);
                	  
                    // Creating an object literal containing the properties we want to pass to the map  
                    var options = {  
                        zoom: 13, // This number can be set to define the initial zoom level of the map
                        center: latlng,
                        mapTypeId: google.maps.MapTypeId.ROADMAP // This value can be set to define the map type ROADMAP/SATELLITE/HYBRID/TERRAIN
                    };  
                    // Calling the constructor, thereby initializing the map  
                    var map = new google.maps.Map(document.getElementById('doctor-search-google-map'), options);  
                	
                    // Define Marker properties
                    var image = new google.maps.MarkerImage('/images/marker_greenB.png',
                    // This marker is 200 pixels wide by 180 pixels tall.
                    new google.maps.Size(200, 180),
                    // The origin for this image is 0,0.
                    new google.maps.Point(0,0),
                    // The anchor for this image is the base of the flagpole at 18,42.
                    new google.maps.Point(18, 42)
                );
    <?php endif; ?>
                // Add Marker
                var marker<?php echo $i ?> = new google.maps.Marker({
                    position: new google.maps.LatLng(<?php echo $doctorLocation->getLatitude() . ", " . $doctorLocation->getLongitude() ?>), 
                    map: map,		
                    icon: image // This path is the custom pin to be shown. Remove this line and the proceeding comma to use default pin
                });                            
<?php endforeach; ?>	
        // Create information window
        function createInfo(title, content) {
            return '<div class="infowindow"><strong>'+ title +'</strong><br />' + content + '</div>';
        }
    });
</script>

